Repository navigation
feat: show popup menu on NotifyHeader more button click - #1457
Conversation
5e66b2f to
9cfbe71
Compare
Reviewer's guide (collapsed on small PRs)Reviewer's GuideNotifyHeader’s more button now opens a positioned popup NotifySettingMenu instead of directly invoking the notification settings API, aligning its behavior with GroupNotify and delegating the actual settings action to a menu item click. Sequence diagram for NotifyHeader more button popup menu flowsequenceDiagram
actor User
participant NotifyHeader
participant moreBtn
participant NotifySettingMenu
participant MenuItem_NotificationSetting
participant NotifyAccessor
User->>NotifyHeader: click more button
NotifyHeader->>moreBtn: handle onClicked
moreBtn->>NotifySettingMenu: set x and y for positioning
moreBtn->>NotifySettingMenu: toggle()
NotifySettingMenu-->>User: display popup menu
User->>MenuItem_NotificationSetting: click
MenuItem_NotificationSetting->>NotifyAccessor: openNotificationSetting()
NotifyAccessor-->>User: show notification settings screen
Class diagram for NotifyHeader and NotifySettingMenu integrationclassDiagram
class NotifyHeader {
}
class moreBtn {
+int width
+int height
+onClicked()
}
class NotifySettingMenu {
+int x
+int y
+toggle()
}
class MenuItem_NotificationSetting {
+string text
+onClicked()
}
NotifyHeader *-- moreBtn
NotifyHeader *-- NotifySettingMenu : headerSettingMenu
NotifySettingMenu *-- MenuItem_NotificationSetting
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Positioning the
NotifySettingMenuusingheaderSettingMenu.widthbefore the menu is shown may yield incorrect centering; consider basing the x/y onimplicitWidth/implicitHeightor positioning in anonAboutToShow/onOpenedhandler so the menu size is known. - If the intent is always to open the menu on click rather than toggling visibility, replacing
headerSettingMenu.toggle()with an explicit open call (e.g.,open()/visible = true) would avoid accidental closing from rapid or repeated clicks.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Positioning the `NotifySettingMenu` using `headerSettingMenu.width` before the menu is shown may yield incorrect centering; consider basing the x/y on `implicitWidth/implicitHeight` or positioning in an `onAboutToShow`/`onOpened` handler so the menu size is known.
- If the intent is always to open the menu on click rather than toggling visibility, replacing `headerSettingMenu.toggle()` with an explicit open call (e.g., `open()`/`visible = true`) would avoid accidental closing from rapid or repeated clicks.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
5e66b2f to
db74d57
Compare
- The more button in NotifyHeader previously called openNotificationSetting() directly on click - Now it shows a NotifySettingMenu popup with a "Notification Setting" menu item, consistent with GroupNotify's more button behavior - The menu is positioned centered below the more button - Uses the existing NotifySettingMenu component with modal and close-on-outside-click behavior - NotifyHeader 的 more 按钮之前点击直接调用 openNotificationSetting() - 现在改为弹出 NotifySettingMenu 菜单,包含"Notification Setting"选项 - 与 GroupNotify 的 more 按钮行为保持一致 - 菜单居中显示在按钮下方,使用已有的 NotifySettingMenu 组件 Log: show popup menu on NotifyHeader more button click Pms: BUG-284815
db74d57 to
ea6cf81
Compare
deepin pr auto review这段代码的 diff 展示了对 以下是对这段代码的审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
综合改进建议代码示例为了解决菜单定位问题和代码结构问题,建议对代码进行如下调整: // ... 其他代码 ...
FocusScope {
// ... 其他属性和组件 ...
// 将菜单定义移到更外层,作为 FocusScope 的直接子元素
NotifySettingMenu {
id: headerSettingMenu
// 使用 aboutToShow 确保在显示前计算位置,此时 width 已就绪
onAboutToShow: {
// 将坐标转换到父容器坐标系,确保定位准确
// 假设 moreBtn 是 headerSettingMenu 的兄弟元素
var pos = moreBtn.mapToItem(headerSettingMenu.parent, 0, moreBtn.height)
headerSettingMenu.x = pos.x + (moreBtn.width / 2) - (headerSettingMenu.width / 2)
headerSettingMenu.y = pos.y
}
MenuItem {
text: qsTr("Notification Setting")
onClicked: {
// 生产环境建议移除 console.log
NotifyAccessor.openNotificationSetting()
}
}
}
// ... 按钮定义 ...
Button {
id: moreBtn
// ... 其他属性 ...
onClicked: function () {
// 仅负责切换显示状态,不处理坐标
headerSettingMenu.toggle()
}
}
}总结这段代码的功能实现没有大问题,主要问题在于菜单定位的时机和代码结构的组织。通过调整菜单定义的位置和利用 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wjyrich, yixinshark The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
The more button in NotifyHeader previously called openNotificationSetting() directly on click
Now it shows a NotifySettingMenu popup with a "Notification Setting" menu item, consistent with GroupNotify's more button behavior
The menu is positioned centered below the more button
Uses the existing NotifySettingMenu component with modal and close-on-outside-click behavior
NotifyHeader 的 more 按钮之前点击直接调用 openNotificationSetting()
现在改为弹出 NotifySettingMenu 菜单,包含"Notification Setting"选项
与 GroupNotify 的 more 按钮行为保持一致
菜单居中显示在按钮下方,使用已有的 NotifySettingMenu 组件
Log: show popup menu on NotifyHeader more button click
Pms: BUG-284815
Summary by Sourcery
Show a popup notification settings menu from the NotifyHeader "more" button instead of opening settings directly.
New Features:
Enhancements: